<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display"%>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>untitled</title>
    <link href="../../css/jdeveloper.css" rel="stylesheet" media="screen"/>
    <link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">
    
    <script language="javascript">
        var seleccion = false;
        
        function check(){
          seleccion = true;
        }
        
        function CheckSelected(){
          if (seleccion){
            document.form1.submit();
          }else{
            alert('Debe seleccionar una cabeza para el grupo familiar');
            return;
          }
        }
    </script>
  </head>
  <body>
  <script src="<%=request.getContextPath()%>/js/displaytag.js" type="text/javascript"></script>
  <form name="form" method="get" action="<%= request.getContextPath()+"/beneficiarios/AsignarGrupoFamiliar.do"%>" >
    <table cellspacing="3" cellpadding="2" border="0" width="80%" align="center">
      <tr>
        <td colspan="3"  class="titulosenblanco">
          <DIV align="center">
            <STRONG>Asignacion Grupo Familiar</STRONG>
          </DIV>
        </td>
      </tr>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
      <logic:iterate id="bene" length="1" name="bene" scope="session">
      <tr>
        <td width="25%" class="celdatabla">
          <STRONG>Beneficiario:</STRONG>
        </td>
        <td width="45%">
          <div class="form">
            <bean:write name="bene" property="numeroDocumento" />-
            <bean:write name="bene" property="nombre1" />
            <bean:write name="bene" property="nombre2" />
            <bean:write name="bene" property="primerApellido" />
            <bean:write name="bene" property="segundoApellido" />
          </div>
        </td>
        <td width="30%">&nbsp;</td>
      </tr>
      </logic:iterate>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
          <DIV align="center">
                      </DIV>
        </td>
      </tr>
      <tr>
        <td colspan="3" class="celdatabla">
          <DIV align="center">
            <STRONG>Busqueda Grupo Familiar</STRONG> 
          </DIV>
        </td>
      </tr>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
      <tr>
        <td>
          <DIV align="center"></DIV>
        </td>
        <td>
          <DIV align="center">Beneficiario cabeza del grupo familiar</DIV>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="25%" class="celdatabla">
          <STRONG>Numero de documento</STRONG>
        </td>
        <td>
          <input type="text" class="form" value="" size="11" name="documento"/>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="25%" class="celdatabla">
          <STRONG>Nombres</STRONG>
        </td>
        <td>
          <input type="text" class="form" value="" name="nombres"/>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="25%" class="celdatabla">
          <STRONG>Apellidos</STRONG>
          </td>
        <td>
          <input type="text" class="form" value="" name="apellidos"/>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
      <tr>
        <td>
          <DIV align="center"></DIV>
        </td>
        <td>
          <DIV align="center">Grupo familiar</DIV>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="25%" class="celdatabla">
          <STRONG>Nombre del grupo Familiar</STRONG>
          </td>
        <td>
          <input type="text" class="form" value="" name="nombregf"/>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
          <DIV align="center">
            <input type="submit" value="Buscar"/>
          </DIV>
        </td>
      </tr>
    </table>
  </form>
  
  <table  cellspacing="3" cellpadding="2" border="0" width="60%" align="center">
   <logic:notPresent name="cabezas">
        <DIV align="left"><%=session.getAttribute("msg")%></DIV>
         <%session.removeAttribute("msg");%>
  </logic:notPresent>
  <logic:present name="cabezas"> 
    <form name="form1" method="get" action="<%= request.getContextPath()+"/beneficiarios/ConfirmarGrupoFamiliar.do"%>">
    <tr>
    <td>
        <display:table name="sessionScope.cabezas" pagesize="20" id="bene" requestURI='<%= request.getContextPath() + "/beneficiarios/AsignarGrupoFamiliar.do" %>' class="bordesTable"  cellpadding="3" cellspacing="1" style="width:100%" >
            <display:column headerClass="headerTable" title="Documento" class="Numero" sortable="true" >
                <bean:write name="bene" property="numeroDocumento" /> 
            </display:column>
            <display:column headerClass="headerTable" title="Nombres y Apellidos" class="Numero" sortable="false">
                <bean:write name="bene" property="nombre1"/> <bean:write name="bene" property="nombre2"/> <bean:write name="bene" property="primerApellido"/> <bean:write name="bene" property="segundoApellido"/>
            </display:column>
            <display:column headerClass="headerTable" title="Nombre Grupo Familiar" class="Numero" sortable="false" >
                <DIV align="center"><bean:write name="bene" property="grupoFamiliar"/> </DIV>
            </display:column>
            <display:column headerClass="headerTable" title="Seleccionar" class="Numero" >
              <DIV align="center"><input  type="radio" name="cabeza" onclick="check()" value="<bean:write name="bene" property="code"/>"/></DIV>   
          </display:column>	
        </display:table>
      </td>
    </tr>
    <tr>
      <td>
        <DIV align="center">
          <input type="button" value="Siguiente" onclick="CheckSelected()"/>
        </DIV>
      </td>
    </tr>
    </form>
  </logic:present>
  </table>
  </body>
</html>
